Skip to content

fix: prefer client bearer token over injected basic auth#180

Open
outrider-jkoch wants to merge 1 commit into
rpardini:masterfrom
outrider-jkoch:pr/bearer-token-auth
Open

fix: prefer client bearer token over injected basic auth#180
outrider-jkoch wants to merge 1 commit into
rpardini:masterfrom
outrider-jkoch:pr/bearer-token-auth

Conversation

@outrider-jkoch
Copy link
Copy Markdown

Registries like quay.io use a two-phase auth flow: the Docker client first exchanges basic credentials for a bearer token, then uses the bearer token for manifest/blob requests.

The old single-map approach unconditionally replaced the client's authorization header with "Basic $dockerAuth" whenever credentials were configured, overwriting the bearer token and causing 401s on content fetches.

The new two-map approach computes what we would inject ($injectedAuth) but only uses it when the client has sent no authorization header at all. If the client has already negotiated auth (bearer or basic), that header is passed through unchanged.

Addresses the upstream @todo comment regarding gcr.io and quay.io auth.

Registries like quay.io use a two-phase auth flow: the Docker client first exchanges basic credentials for a bearer token, then uses the bearer token for manifest/blob requests.

The old single-map approach unconditionally replaced the client's authorization header with "Basic $dockerAuth" whenever credentials were configured, overwriting the bearer token and causing 401s on content fetches.
    
The new two-map approach computes what we would inject ($injectedAuth) but only uses it when the client has sent no authorization header at all. If the client has already negotiated auth (bearer or basic), that header is passed through unchanged.
    
Addresses the upstream @todo comment regarding gcr.io and quay.io auth.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant